
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>更灵活的设计--泛型 · Java笔记Blog</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="snowdreams1006">
        
        
    
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-prism/prism-tomorrow.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-timeline/timeline.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="java15.html" />
    
    
    <link rel="prev" href="java13.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://blog.lichongbing.com/" target="_blank" class="custom-link">blog</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="java5.html">
            
                <a href="java5.html">
            
                    
                    Java基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="java.html">
            
                <a href="java.html">
            
                    
                    Java知识思维导图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="java5.html">
            
                <a href="java5.html#2">
            
                    
                    Java开发环境搭建
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="java5.html">
            
                <a href="java5.html#21">
            
                    
                    1.1 Java开发环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="java5.html">
            
                <a href="java5.html#22">
            
                    
                    1.2 安装Java开发工具箱
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="java6.html">
            
                <a href="java6.html#3">
            
                    
                    Java程序要素概览
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="java7.html">
            
                <a href="java7.html">
            
                    
                    Java编程基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="java8.html">
            
                <a href="java8.html">
            
                    
                    基础编程元素--运算符 表达式 语句与流程控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="java9.html">
            
                <a href="java9.html">
            
                    
                    常用的数据结构--数组与枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="java10.html">
            
                <a href="java10.html">
            
                    
                    面向对象设计的核心--类与对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="java11.html">
            
                <a href="java11.html">
            
                    
                    重复调用的代码块--方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="java12.html">
            
                <a href="java12.html">
            
                    
                    面向对象设计的精华--类的封装 继承 多态
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.9.1" data-path="java12.html">
            
                <a href="java12.html#1">
            
                    
                    8.1 面向对象的三大特点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.2" data-path="java12.html">
            
                <a href="java12.html#4">
            
                    
                    8.2 封装的实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.3" data-path="java12.html">
            
                <a href="java12.html#7">
            
                    
                    8.3 继承的实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.4" data-path="java12.html">
            
                <a href="java12.html#8">
            
                    
                    8.4 深度认识类的继承
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.5" data-path="java12.html">
            
                <a href="java12.html#9">
            
                    
                    8.5 覆写
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.6" data-path="java12.html">
            
                <a href="java12.html#12">
            
                    
                    8.6 多态的实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.7" data-path="java12.html">
            
                <a href="java12.html#10">
            
                    
                    8.7 高手点拨
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9.8" data-path="java12.html">
            
                <a href="java12.html#11">
            
                    
                    8.8 实战练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="java13.html">
            
                <a href="java13.html">
            
                    
                    凝练才是美--抽象类 接口 内部类
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.10.1" data-path="java13.html">
            
                <a href="java13.html#1">
            
                    
                    9.1 抽象类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10.2" data-path="java13.html">
            
                <a href="java13.html#2">
            
                    
                    9.2 接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10.3" data-path="java13.html">
            
                <a href="java13.html#3">
            
                    
                    9.3 内部类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10.4" data-path="java13.html">
            
                <a href="java13.html#4">
            
                    
                    9.4 匿名内部类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10.5" data-path="java13.html">
            
                <a href="java13.html#5">
            
                    
                    9.5 匿名对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10.6" data-path="java13.html">
            
                <a href="java13.html#6">
            
                    
                    9.6 高手点拨
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10.7" data-path="java13.html">
            
                <a href="java13.html#7">
            
                    
                    9.7 实战练习
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter active" data-level="1.2.11" data-path="java14.html">
            
                <a href="java14.html">
            
                    
                    更灵活的设计--泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.12" data-path="java15.html">
            
                <a href="java15.html">
            
                    
                    更强大和方便的功能--注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.13" >
            
                <span>
            
                    
                    设计实践--常用的设计模式
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.14" >
            
                <span>
            
                    
                    存储类的仓库--Java常用类库
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.15" >
            
                <span>
            
                    
                    防患未然--异常的捕获与处理
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.16" >
            
                <span>
            
                    
                    齐头并进，并发任务的处理--多线程
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.17" >
            
                <span>
            
                    
                    文件I/O操作
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.18" >
            
                <span>
            
                    
                    Java反射
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.19" >
            
                <span>
            
                    
                    数据持久化方法--对象序列化
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.20" >
            
                <span>
            
                    
                    Maven Git Linux的基础使用
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="java6.html">
            
                <a href="java6.html">
            
                    
                    JavaWeb基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" >
            
                <span>
            
                    
                    JavaWeb的服务器与ide工具
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" >
            
                <span>
            
                    
                    JSP基本语法
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" >
            
                <span>
            
                    
                    JSP内置对象
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" >
            
                <span>
            
                    
                    JavaBean技术
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" >
            
                <span>
            
                    
                    Servlet技术
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" >
            
                <span>
            
                    
                    文件的上传与下载
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" >
            
                <span>
            
                    
                    过滤器和监听器
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" >
            
                <span>
            
                    
                    JavaWeb的数据库操作
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" >
            
                <span>
            
                    
                    EL表达式语言
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" >
            
                <span>
            
                    
                    JSTL标签
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    JavaWeb前端
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" >
            
                <span>
            
                    
                    HTML与CSS网页开发基础
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" >
            
                <span>
            
                    
                    JavaScript脚本语言
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" >
            
                <span>
            
                    
                    Ajax技术
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" >
            
                <span>
            
                    
                    JQuery技术
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" >
            
                <span>
            
                    
                    JSON技术
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" >
            
                <span>
            
                    
                    Java正则表达式
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" >
            
                <span>
            
                    
                    Vue.js
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" >
            
                <span>
            
                    
                    BootStap框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" >
            
                <span>
            
                    
                    Flutter框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" >
            
                <span>
            
                    
                    Angular框架 
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" >
            
                <span>
            
                    
                    webpack
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.12" >
            
                <span>
            
                    
                    微信小程序
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    JavaWeb数据库
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" >
            
                <span>
            
                    
                    MySQL
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" >
            
                <span>
            
                    
                    JDBC
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" >
            
                <span>
            
                    
                    C3P0
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" >
            
                <span>
            
                    
                    Druid
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    JavaWeb强化
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" >
            
                <span>
            
                    
                    设计模式
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" >
            
                <span>
            
                    
                    JVM优化
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" >
            
                <span>
            
                    
                    数据结构算法
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" >
            
                <span>
            
                    
                    多线程高级
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" >
            
                <span>
            
                    
                    MINA
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" >
            
                <span>
            
                    
                    Netty
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" >
            
                <span>
            
                    
                    NIO
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    JavaWeb框架
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" >
            
                <span>
            
                    
                    Struct2框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" >
            
                <span>
            
                    
                    JPA
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" >
            
                <span>
            
                    
                    Spring Data
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" >
            
                <span>
            
                    
                    Hibemate技术
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" >
            
                <span>
            
                    
                    Spring核心之IoC
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" >
            
                <span>
            
                    
                    Spring核心之AOP
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" >
            
                <span>
            
                    
                    Spring MVC框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" >
            
                <span>
            
                    
                    Mybatis框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" >
            
                <span>
            
                    
                    Mybatis Plus
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" >
            
                <span>
            
                    
                    JavaWeb业务解决方案
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" >
            
                <span>
            
                    
                    ElasticSearch
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" >
            
                <span>
            
                    
                    Kibana
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" >
            
                <span>
            
                    
                    Logstash
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" >
            
                <span>
            
                    
                    LOG4J
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" >
            
                <span>
            
                    
                    Logback
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" >
            
                <span>
            
                    
                    SLF4J
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" >
            
                <span>
            
                    
                    Solr
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" >
            
                <span>
            
                    
                    D3
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" >
            
                <span>
            
                    
                    JCL
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.10" >
            
                <span>
            
                    
                    AntV
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.11" >
            
                <span>
            
                    
                    Beats
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.12" >
            
                <span>
            
                    
                    Lucene
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.13" >
            
                <span>
            
                    
                    POI
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.14" >
            
                <span>
            
                    
                    FreeMaker
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.15" >
            
                <span>
            
                    
                    Thymeleaf
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.16" >
            
                <span>
            
                    
                    Shiro
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.17" >
            
                <span>
            
                    
                    Spring Security
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.18" >
            
                <span>
            
                    
                    JasperReport
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.19" >
            
                <span>
            
                    
                    Quartz
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.20" >
            
                <span>
            
                    
                    Elastic-Job
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.21" >
            
                <span>
            
                    
                    Activiti
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.22" >
            
                <span>
            
                    
                    微信支付
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.23" >
            
                <span>
            
                    
                    支付宝支付
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.24" >
            
                <span>
            
                    
                    百度地图
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.25" >
            
                <span>
            
                    
                    高德地图
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" >
            
                <span>
            
                    
                    JavaWeb中介组件
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" >
            
                <span>
            
                    
                    Redis框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" >
            
                <span>
            
                    
                    FastDFS
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" >
            
                <span>
            
                    
                    定时任务
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" >
            
                <span>
            
                    
                    RabbitMQ
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" >
            
                <span>
            
                    
                    RocketMQ
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.6" >
            
                <span>
            
                    
                    JMS
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.7" >
            
                <span>
            
                    
                    MyCat
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.8" >
            
                <span>
            
                    
                    RabbitMQ
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.9" >
            
                <span>
            
                    
                    Kafka
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.10" >
            
                <span>
            
                    
                    Sharding-JDBC
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.11" >
            
                <span>
            
                    
                    Neo4j
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.12" >
            
                <span>
            
                    
                    MongoDB
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.13" >
            
                <span>
            
                    
                    ELK
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.14" >
            
                <span>
            
                    
                    Restful风格编程
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.15" >
            
                <span>
            
                    
                    Swagger文档
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.16" >
            
                <span>
            
                    
                    JMeter
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" >
            
                <span>
            
                    
                    JavaWeb微服务分布框架
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" >
            
                <span>
            
                    
                    Spring Boot框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" >
            
                <span>
            
                    
                    Spring Cloud框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" >
            
                <span>
            
                    
                    Zookeeper
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" >
            
                <span>
            
                    
                    Dubbo框架
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" >
            
                <span>
            
                    
                    Eureka
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" >
            
                <span>
            
                    
                    Consul
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" >
            
                <span>
            
                    
                    Hystrix
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.8" >
            
                <span>
            
                    
                    Zuul
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.9" >
            
                <span>
            
                    
                    Gateway
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.10" >
            
                <span>
            
                    
                    Skywalking
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.11" >
            
                <span>
            
                    
                    Pinpoint
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" >
            
                <span>
            
                    
                    JavaWeb部署
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" >
            
                <span>
            
                    
                    Docker
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" >
            
                <span>
            
                    
                    项目构建
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="java4.html">
            
                <a href="java4.html#1">
            
                    
                    JavaWeb实战项目
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="java4.html">
            
                <a href="java4.html#2">
            
                    
                    微人事项目实战
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="java16.html">
            
                <a href="java16.html">
            
                    
                    新蜂商城
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="moutn10.html">
            
                <a href="moutn10.html">
            
                    
                    2020年10月账本
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="day23.html">
            
                <a href="day23.html">
            
                    
                    10月23日
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="day29.html">
            
                <a href="day29.html">
            
                    
                    10月29日
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="moutn11.md">
            
                <span>
            
                    
                    2020年11月账本
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >更灵活的设计--泛型</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
<div id="vip-container">
    <h3 id="&#x66F4;&#x7075;&#x6D3B;&#x7684;&#x8BBE;&#x8BA1;&#x2014;&#x2014;&#x6CDB;&#x578B;">&#x66F4;&#x7075;&#x6D3B;&#x7684;&#x8BBE;&#x8BA1;&#x2014;&#x2014;&#x6CDB;&#x578B;</h3>
<p>JDK 5.0&#x4EE5;&#x540E;&#x589E;&#x52A0;&#x4E86;&#x6CDB;&#x578B;&#xFF0C;&#x6CDB;&#x578B;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4E00;&#x79CD;&#x7C7B;&#x578B;&#x6216;&#x65B9;&#x6CD5;&#x64CD;&#x4F5C;&#x5404;&#x79CD;&#x4E0D;&#x540C;&#x7684;&#x7C7B;&#x578B;&#xFF0C;&#x5176;&#x63D0;&#x4F9B;&#x4E86;&#x7F16;&#x8BD1;&#x65F6;&#x7C7B;&#x578B;&#x7684;&#x5B89;&#x5168;&#x6027;&#x3002;
&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x6BD4;&#x8F83;&#x5927;&#x7684;&#x6539;&#x52A8;&#xFF0C;&#x751A;&#x81F3;&#x6709;&#x4E9B;Java&#x7684;API&#x90FD;&#x8FDB;&#x884C;&#x4E86;&#x91CD;&#x5199;&#xFF0C;&#x6CDB;&#x578B;&#x7684;&#x5F15;&#x5165;&#x65B9;&#x4FBF;&#x4E86;&#x6211;&#x4EEC;&#x7684;&#x5F00;&#x53D1;&#x3002;
&#x901A;&#x8FC7;&#x672C;&#x7AE0;&#x7684;&#x5B66;&#x4E60;&#xFF0C;&#x8BFB;&#x8005;&#x5C06;&#x7406;&#x89E3;&#x5E76;&#x638C;&#x63E1;&#x6CDB;&#x578B;&#x7684;&#x6982;&#x5FF5;&#x548C;&#x4F7F;&#x7528;&#x65B9;&#x6CD5;&#xFF0C;&#x5305;&#x62EC;&#x6CDB;&#x578B;&#x7C7B;&#x548C;&#x6CDB;&#x578B;&#x65B9;&#x6CD5;&#x3002;
&#x672C;&#x7AE0;&#x8981;&#x70B9;&#xFF08;&#x5DF2;&#x638C;&#x63E1;&#x7684;&#x5728;&#x65B9;&#x6846;&#x4E2D;&#x6253;&#x94A9;&#xFF09;&#x6CDB;&#x578B;&#x6982;&#x5FF5;&#x6CDB;&#x578B;&#x7C7B;&#x3001;&#x6CDB;&#x578B;&#x65B9;&#x6CD5;&#x548C;&#x6CDB;&#x578B;&#x63A5;&#x53E3;&#x6CDB;&#x578B;&#x4F7F;&#x7528;&#x7684;&#x9650;&#x5236;&#x6CDB;&#x578B;&#x901A;&#x914D;&#x7B26;&#x6CDB;&#x578B;&#x7EE7;&#x627F;10.1 &#x6CDB;&#x578B;&#x7684;&#x6982;&#x5FF5;&#x6240;&#x8C13;&#x6CDB;&#x578B;&#xFF0C;&#x5C31;&#x662F;&#x5141;&#x8BB8;&#x5728;&#x5B9A;&#x4E49;&#x7C7B;&#x3001;&#x63A5;&#x53E3;&#x7684;&#x65F6;&#x5019;&#x6307;&#x5B9A;&#x7C7B;&#x578B;&#x5F62;&#x53C2;&#xFF08;&#x7C7B;&#x578B;&#x7684;&#x5F62;&#x5F0F;&#x53C2;&#x6570;&#x7684;&#x7B80;&#x79F0;&#xFF09;&#xFF0C;&#x8FD9;&#x4E2A;&#x7C7B;&#x578B;&#x5F62;&#x53C2;&#x5C06;&#x5728;&#x58F0;&#x660E;&#x53D8;&#x91CF;&#x3001;&#x521B;&#x5EFA;&#x5BF9;&#x8C61;&#x65F6;&#x786E;&#x5B9A;&#xFF0C;&#x5373;&#x4F20;&#x5165;&#x5B9E;&#x9645;&#x7684;&#x7C7B;&#x578B;&#x53C2;&#x6570;&#xFF0C;&#x4E5F;&#x53EF;&#x79F0;&#x4E3A;&#x7C7B;&#x578B;&#x5B9E;&#x53C2;&#xFF0C;&#x8FD9;&#x5B9E;&#x9645;&#x4E0A;&#x662F;&#x5C06;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x53C2;&#x6570;&#x5316;&#x3002;
&#x6CDB;&#x578B;&#x53EF;&#x4EE5;&#x7528;&#x6765;&#x5B9A;&#x4E49;&#x6CDB;&#x578B;&#x7C7B;&#x3001;&#x6CDB;&#x578B;&#x65B9;&#x6CD5;&#x548C;&#x6CDB;&#x578B;&#x63A5;&#x53E3;&#x3002;
&#x5728;JDK 5.0&#x4E4B;&#x540E;&#x7684;&#x4EE3;&#x7801;&#x4E2D;&#xFF0C;&#x5982;&#x679C;&#x5B9A;&#x4E49;&#x4E86;&#x6CDB;&#x578B;&#xFF0C;&#x4F46;&#x662F;&#x6CA1;&#x6709;&#x4F7F;&#x7528;&#x6CDB;&#x578B;&#x7684;&#x8BDD;&#xFF0C;&#x4E3A;&#x4E86;&#x517C;&#x5BB9;&#x4E4B;&#x524D;&#x7248;&#x672C;&#x7684;JDK&#xFF0C;&#x4F1A;&#x7ED9;&#x51FA;&#x4E00;&#x4E2A;&#x8B66;&#x544A;&#x9519;&#x8BEF;&#xFF0C;&#x4F46;&#x4E0D;&#x5F71;&#x54CD;&#x7F16;&#x8BD1;&#x548C;&#x8FD0;&#x884C;&#x3002;
&#x8303;&#x4F8B;10-1 JDK&#x7248;&#x672C;&#x4E2D;&#x6709;&#x5173;&#x6CDB;&#x578B;&#x5411;&#x4E0B;&#x517C;&#x5BB9;&#x7684;&#x8B66;&#x544A;&#x9519;&#x8BEF;</p>
<pre class="language-"><code class="lang-java">&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">Base</span> <span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">T</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span> <span class="token punctuation">{</span>
&#x3000;&#x3000; <span class="token class-name">T</span> m<span class="token punctuation">;</span>
&#x3000;&#x3000; <span class="token class-name">Base</span><span class="token punctuation">(</span><span class="token class-name">T</span> t<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;  m <span class="token operator">=</span> t<span class="token punctuation">;</span>
&#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">print</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;  <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">&quot;base print &#xFF1A;&quot;</span> <span class="token operator">+</span> m<span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p>&#x3000;Base<string>; base=new Base<string>;
&#x3000;Base<string>; base1=new Base(&quot;aa&quot;);&#x7B2C;
&#x884C;&#x4E0D;&#x4F1A;&#x62A5;&#x8B66;&#x544A;&#x9519;&#x8BEF;&#xFF0C;&#x7B2C;
&#x884C;&#x4F1A;&#x62A5;&#x201C;Base is a raw type&#x201D;&#x7684;&#x9519;&#x8BEF;&#x3002;</string></string></string></p>
<p>.2 &#x6CDB;&#x578B;&#x7C7B;&#x7684;&#x5B9A;&#x4E49;&#x6CDB;&#x578B;&#x7C7B;&#x7684;&#x5B9A;&#x4E49;&#x8BED;&#x6CD5;&#x5982;&#x4E0B;&#x6240;&#x793A;&#x3002;
[&#x8BBF;&#x95EE;&#x4FEE;&#x9970;&#x7B26;] class &#x7C7B;&#x540D;&#x79F0;&amp;lt;T&amp;gt;&#x6CDB;&#x578B;&#x7C7B;&#x7684;&#x5B9A;&#x4E49;&#x4E3B;&#x8981;&#x4F5C;&#x7528;&#x5728;&#x4E8E;&#x5728;&#x7C7B;&#x88AB;&#x5B9E;&#x4F8B;&#x5316;&#x540E;&#xFF0C;&#x65B9;&#x4FBF;&#x4F20;&#x5165;&#x5177;&#x4F53;&#x7684;&#x53C2;&#x6570;&#x5BF9;&#x7C7B;&#x7684;&#x6210;&#x5458;&#x5C5E;&#x6027;&#x548C;&#x6210;&#x5458;&#x65B9;&#x6CD5;&#x8FDB;&#x884C; &#x66FF;&#x6362;&#x3002;
&#x8303;&#x4F8B;10-2 &#x6CDB;&#x578B;&#x7C7B;&#x5B9A;&#x4E49;</p>
<pre class="language-"><code class="lang-java">&#x3000;&#x3000; <span class="token class-name">T</span> m<span class="token punctuation">;</span>
&#x3000;&#x3000; <span class="token class-name">Base</span><span class="token punctuation">(</span><span class="token class-name">T</span> t<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;  m <span class="token operator">=</span> t<span class="token punctuation">;</span>
&#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token class-name">T</span> <span class="token function">getM</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;  <span class="token keyword">return</span> m<span class="token punctuation">;</span>
&#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">print</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;  <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">&quot;base print &#xFF1A;&quot;</span> <span class="token operator">+</span> m<span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;  <span class="token class-name">Base</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span> base<span class="token operator">=</span><span class="token keyword">new</span> <span class="token class-name">Base</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">(</span><span class="token string">&quot;base class is general&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;  <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>base<span class="token punctuation">.</span><span class="token function">getM</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p>&#x7B2C;01&#x884C;&#x5B9A;&#x4E49;&#x4E86;&#x6CDB;&#x578B;&#x7C7B;Base&#xFF0C;&#x5E76;&#x901A;&#x8FC7;T&#x6765;&#x5B9A;&#x4E49;&#x6210;&#x5458;&#x53D8;&#x91CF;m&#xFF0C;&#x5B9A;&#x4E49;&#x4E86;getM&#x65B9;&#x6CD5;&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x548C;&#x6784;&#x9020;&#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;t&#xFF0C;13&#x884C;&#x5B9E;&#x4F8B;&#x4E86;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;base&#xFF0C;&#x5E76;&#x4F20;&#x5165;String&#x7C7B;&#x4F5C;&#x4E3A;T&#x7684;&#x7C7B;&#x578B;&#xFF0C;&#x8FD9;&#x4E2A;&#x88AB;&#x79F0;&#x4E3A;&#x6CDB;&#x578B;&#x7C7B;&#x7684;&#x5B9E;&#x4F8B;&#x5316;&#xFF0C;&#x6709;&#x70B9;&#x7C7B;&#x4F3C;&#x4E8E;&#x7C7B;&#x7684;&#x5B9E;&#x4F8B;&#x5316;&#x3002;
&#x4E4B;&#x540E;m&#x3001;t&#x7684;&#x7C7B;&#x578B;&#x5C31;&#x53D8;&#x6210;&#x4E86;String&#xFF0C;getM&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x4E5F;&#x662F;String&#x3002;
&#x5176;&#x5B9E;&#xFF0C;&#x662F;&#x628A;T&#x4F5C;&#x4E3A;&#x53C2;&#x6570;&#x6765;&#x5B9A;&#x4E49;&#x8FD9;&#x51E0;&#x4E2A;&#x53D8;&#x91CF;&#x7684;&#x7C7B;&#x578B;&#x548C;&#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#x7C7B;&#x578B;&#x3002;
T&#x53EF;&#x4EE5;&#x7528;&#x4EFB;&#x4F55;&#x4E00;&#x79CD;&#x5F15;&#x7528;&#x7C7B;&#x578B;&#xFF0C;&#x4F46;&#x662F;&#x4E0D;&#x5141;&#x8BB8;&#x4F7F;&#x7528;&#x57FA;&#x672C;&#x7C7B;&#x578B;&#xFF0C;&#x5982;int&#x3001;double&#x3001;char&#x3001;boolean&#x7B49;&#x662F;&#x4E0D;&#x5141;&#x8BB8;&#x7684;&#x3002;
&#x7C7B;&#x578B;&#x7C7B;&#x88AB;&#x5B9A;&#x4E49;&#x540E;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;T&#x6765;&#x5B9A;&#x4E49;&#x5176;&#x6210;&#x5458;&#x53D8;&#x91CF;&#x548C;&#x6210;&#x5458;&#x65B9;&#x6CD5;&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x4E0E;&#x53C2;&#x6570;&#x3002;
10.3 &#x6CDB;&#x578B;&#x65B9;&#x6CD5;&#x7684;&#x5B9A;&#x4E49;&#x6CDB;&#x578B;&#x65B9;&#x6CD5;&#x4E3B;&#x8981;&#x7528;&#x4E8E;&#x5BB9;&#x5668;&#x7C7B;&#xFF0C;Java&#x4E2D;&#x4EFB;&#x4F55;&#x65B9;&#x6CD5;&#xFF0C;&#x5305;&#x62EC;&#x9759;&#x6001;&#x7684;&#xFF08;&#x6CE8;&#x610F;&#xFF0C;&#x548C;&#x6CDB;&#x578B;&#x7C7B;&#x4E0D;&#x4E00;&#x6837;&#xFF0C;&#x6CDB;&#x578B;&#x7C7B;&#x4E0D;&#x5141;&#x8BB8;&#x5728;&#x9759;&#x6001;&#x73AF;&#x5883;&#x4E2D;&#x4F7F;&#x7528;&#xFF09;&#x548C;&#x975E;&#x9759;&#x6001;&#x7684;&#xFF0C;&#x5747;&#x53EF;&#x4EE5;&#x7528;&#x6CDB;&#x578B;&#x6765;&#x5B9A;&#x4E49;&#xFF0C;&#x800C;&#x4E14;&#x548C;&#x6240;&#x5728;&#x7C7B;&#x662F;&#x5426;&#x662F;&#x6CDB;&#x578B;&#x6CA1;&#x6709;&#x5173;&#x7CFB;&#xFF0C;&#x4E0B;&#x9762;&#x662F;&#x6CDB;&#x578B;&#x65B9;&#x6CD5;&#x7684;&#x5B9A;&#x4E49;&#x3002;
[public] [static] <t>; &#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B; &#x65B9;&#x6CD5;&#x540D;&#xFF08;T&#x53C2;&#x6570;&#x5217;&#x8868;&#xFF09;&#x8303;&#x4F8B;10-3 &#x6CDB;&#x578B;&#x65B9;&#x6CD5;&#x5B9A;&#x4E49;</t></p>
<pre class="language-"><code class="lang-java">&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">GeneralMethod</span> <span class="token punctuation">{</span>&#x3000;&#x3000;
&#x3000;&#x3000;&#x3000;  <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">U</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span> <span class="token keyword">void</span> <span class="token function">print</span><span class="token punctuation">(</span><span class="token class-name">U</span><span class="token punctuation">[</span><span class="token punctuation">]</span> list<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span><span class="token punctuation">;</span> list<span class="token punctuation">.</span>length<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">print</span><span class="token punctuation">(</span><span class="token string">&quot; &quot;</span> <span class="token operator">+</span> list<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;  <span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;  <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token class-name">String</span> a<span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token operator">=</span><span class="token punctuation">{</span><span class="token string">&quot;a&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;b&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;c&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;d&quot;</span><span class="token punctuation">,</span><span class="token string">&quot;e&quot;</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token class-name">Character</span> b<span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token operator">=</span><span class="token punctuation">{</span><span class="token string">&apos;1&apos;</span><span class="token punctuation">,</span><span class="token string">&apos;2&apos;</span><span class="token punctuation">,</span><span class="token string">&apos;3&apos;</span><span class="token punctuation">,</span><span class="token string">&apos;4&apos;</span><span class="token punctuation">,</span><span class="token string">&apos;5&apos;</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token class-name">GeneralMethod</span><span class="token punctuation">.</span><span class="token function">print</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token class-name">GeneralMethod</span><span class="token punctuation">.</span><span class="token function">print</span><span class="token punctuation">(</span>b<span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;  <span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p>&#x8F93;&#x51FA;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#x3002;
a b c d e1 2 3 4 5&#x4F7F;&#x7528;&#x6CDB;&#x578B;&#x65B9;&#x6CD5;&#x65F6;&#xFF0C;&#x81F3;&#x5C11;&#x8FD4;&#x56DE;&#x503C;&#x6216;&#x53C2;&#x6570;&#x6709;&#x4E00;&#x4E2A;&#x662F;&#x6CDB;&#x578B;&#x5B9A;&#x4E49;&#x7684;&#xFF0C;&#x800C;&#x4E14;&#x5E94;&#x8BE5;&#x4FDD;&#x6301;&#x4E00;&#x81F4;&#xFF0C;&#x5426;&#x5219;&#x53EF;&#x80FD;&#x4F1A;&#x53D7;&#x5230;&#x5404;&#x79CD;&#x9650;&#x5236;&#xFF0C;&#x56E0;&#x6B64;&#xFF0C;&#x8FD9;&#x91CC;&#x5EFA;&#x8BAE;&#x4FDD;&#x6301;&#x4E00;&#x81F4;&#x3002;
10.4 &#x6CDB;&#x578B;&#x63A5;&#x53E3;&#x7684;&#x5B9A;&#x4E49;&#x63A5;&#x53E3;&#x4E5F;&#x53EF;&#x4EE5;&#x5B9A;&#x4E49;&#x4E3A;&#x6CDB;&#x578B;&#x7684;&#xFF0C;&#x8BED;&#x6CD5;&#x5982;&#x4E0B;&#x6240;&#x793A;&#x3002;
[public] interface  <t>;&#x8303;&#x4F8B;10-4 &#x6CDB;&#x578B;&#x63A5;&#x53E3;&#x5B9A;&#x4E49;</t></p>
<pre class="language-"><code class="lang-java">&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">GeneralInterface</span> <span class="token punctuation">{</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;<span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">TestIBase</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">getA</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">interface</span> <span class="token class-name">IBase</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">T</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">{</span>&#x3000;
&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token class-name">T</span> <span class="token function">getA</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;  <span class="token keyword">public</span> <span class="token class-name">T</span> <span class="token function">getB</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">class</span> <span class="token class-name">TestIBase</span> <span class="token keyword">implements</span> <span class="token class-name">IBase</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">{</span>&#x3000;
&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">getA</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>&#x3000;&#x3000;
&#x3000;&#x3000;&#x3000;&#x3000;<span class="token keyword">return</span> <span class="token string">&quot;A&quot;</span><span class="token punctuation">;</span>
&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">getB</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>&#x3000;
&#x3000;&#x3000;&#x3000;&#x3000;<span class="token keyword">return</span> <span class="token string">&quot;B&quot;</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000; <span class="token punctuation">}</span>&#x3000;
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p>&#x6309;&#x7167;&#x6CDB;&#x578B;&#x63A5;&#x53E3;&#x7684;&#x8BED;&#x6CD5;&#x89C4;&#x5B9A;&#xFF0C;&#x4E0D;&#x80FD;&#x5728;&#x63A5;&#x53E3;&#x4E2D;&#x4F7F;&#x7528;&#x6CDB;&#x578B;&#x6765;&#x5B9A;&#x4E49;&#x6210;&#x5458;&#x5C5E;&#x6027;&#xFF0C;&#x4E0B;&#x9762;&#x7684;&#x5B9A;&#x4E49;&#x65B9;&#x6CD5;&#x662F;&#x4E0D;&#x88AB;&#x5141;&#x8BB8;&#x7684;&#xFF0C;&#x8FD9;&#x4E00;&#x70B9;&#x548C;&#x6CDB;&#x578B;&#x7C7B;&#x662F;&#x4E0D;&#x540C;&#x7684;&#x3002;</p>
<pre class="language-"><code class="lang-java">&#x3000;<span class="token keyword">interface</span> <span class="token class-name">IBase</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">T</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">{</span>&#x3000;
&#x3000;&#x3000; <span class="token class-name">T</span> m<span class="token punctuation">;</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token class-name">T</span> <span class="token function">getA</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token class-name">T</span> <span class="token function">getB</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p>&#x7B2C;02&#x884C;&#x4F1A;&#x62A5;&#x201C;Cannot make a static reference to the non-static typeT&#x201D;&#x9519;&#x8BEF;&#xFF0C;&#x8FD9;&#x8868;&#x793A;&#x5728;&#x63A5;&#x53E3;&#x4E2D;&#x76F4;&#x63A5;&#x5B9A;&#x4E49;&#x6CDB;&#x578B;&#x6210;&#x5458;&#x5C5E;&#x6027;&#x662F;&#x4E0D;&#x88AB;&#x5141;&#x8BB8;&#x7684;&#x3002;
10.5 &#x6CDB;&#x578B;&#x7684;&#x4F7F;&#x7528;&#x9650;&#x5236;&#x548C;&#x901A;&#x914D;&#x7B26;&#x7684;&#x4F7F;&#x7528;&#x5728;&#x6CDB;&#x578B;&#x7684;&#x4F7F;&#x7528;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x6709;&#x4E9B;&#x60C5;&#x51B5;&#x662F;&#x4E0D;&#x80FD;&#x4F7F;&#x7528;&#x6CDB;&#x578B;&#x7684;&#xFF0C;&#x6709;&#x65F6;&#x5F00;&#x53D1;&#x8005;&#x5BF9;&#x6CDB;&#x578B;&#x5B9E;&#x4F8B;&#x5316;&#x4E5F;&#x60F3;&#x8FDB;&#x884C;&#x4E00;&#x4E9B;&#x9650;&#x5236;&#xFF0C;&#x8FD9;&#x4E9B;&#x90FD;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x6CDB;&#x578B;&#x7684;&#x4F7F;&#x7528;&#x9650;&#x5236;&#x6765;&#x5B8C;&#x6210;&#xFF0C;&#x5C3D;&#x7BA1;&#x5B83;&#x4EEC;&#x662F;&#x6709;&#x9650;&#x7684;&#x3002;
&#x53E6;&#x5916;&#xFF0C;&#x5728;&#x6CDB;&#x578B;&#x7684;&#x5B9A;&#x4E49;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x901A;&#x914D;&#x7B26;&#x6765;&#x63D0;&#x9AD8;&#x6CDB;&#x578B;&#x5B9A;&#x4E49;&#x7684;&#x7075;&#x6D3B;&#x6027;&#x3002;
10.5.1 &#x6CDB;&#x578B;&#x7684;&#x4F7F;&#x7528;&#x9650;&#x5236;&#x8FD9;&#x91CC;&#x6CDB;&#x578B;&#x7684;&#x4F7F;&#x7528;&#x9650;&#x5236;&#x6709;&#x4E24;&#x79CD;&#x542B;&#x4E49;&#xFF1A;&#x5176;&#x4E00;&#x662F;&#x4EC0;&#x4E48;&#x60C5;&#x51B5;&#x4E0B;&#x4E0D;&#x80FD;&#x4F7F;&#x7528;&#x6CDB;&#x578B;&#xFF0C;&#x5176;&#x4E8C;&#x662F;&#x5F00;&#x53D1;&#x8005;&#x60F3;&#x9650;&#x5236;&#x6CDB;&#x578B;&#x7684;&#x5B9E;&#x4F8B;&#x5316;&#x8FC7;&#x7A0B;&#x3002;
&#x4EE5;&#x4E0B;&#x51E0;&#x79CD;&#x60C5;&#x51B5;&#x6CDB;&#x578B;&#x662F;&#x4E0D;&#x88AB;&#x5141;&#x8BB8;&#x7684;&#x3002;
&#xFF08;1&#xFF09;&#x4E0D;&#x80FD;&#x4F7F;&#x7528;&#x6CDB;&#x578B;&#x7684;&#x5F62;&#x53C2;&#x521B;&#x5EFA;&#x5BF9;&#x8C61;&#x3002;
&#x4E0B;&#x9762;&#x7684;&#x8BED;&#x53E5;&#x662F;&#x9519;&#x8BEF;&#x7684;&#x3002;
T o=new T();&#xFF08;2&#xFF09;&#x4E0D;&#x80FD;&#x5728;&#x9759;&#x6001;&#x73AF;&#x5883;&#x4E2D;&#x4F7F;&#x7528;&#x6CDB;&#x578B;&#x7C7B;&#x7684;&#x7C7B;&#x578B;&#x53C2;&#x6570;&#xFF0C;&#x4E0B;&#x9762;&#x7684;&#x7528;&#x6CD5;&#x662F;&#x9519;&#x8BEF;&#x7684;&#x3002;
public class A<t>;{&#x3000; public static T t;//&#x9519;&#x8BEF;&#x3000; public T getA&#xFF08;&#xFF09;{//&#x5141;&#x8BB8;&#x3000;  &#x2026;&#x3000; }}&#xFF08;3&#xFF09;&#x5F02;&#x5E38;&#x7C7B;&#x4E0D;&#x80FD;&#x662F;&#x6CDB;&#x578B;&#x7684;&#xFF0C;&#x6362;&#x53E5;&#x8BDD;&#x8BF4;&#xFF0C;&#x6CDB;&#x578B;&#x7C7B;&#x4E0D;&#x80FD;&#x7EE7;&#x627F;java.lang.Throwable&#x7C7B;&#x3002;
&#x5982;&#x7C7B;D&#x7684;&#x5B9A;&#x4E49;public class D <t>; extends java.lang.Throwable&#x5C31;&#x662F;&#x4E0D;&#x88AB;&#x5141;&#x8BB8;&#x7684;&#x3002;
&#xFF08;4&#xFF09;&#x6CDB;&#x578B;&#x4E0D;&#x80FD;&#x521D;&#x59CB;&#x5316;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;&#xFF0C;&#x4F46;&#x662F;&#x53EF;&#x4EE5;&#x58F0;&#x660E;&#x6570;&#x7EC4;&#x3002;
&#x4E0B;&#x9762;&#x7684;&#x7528;&#x6CD5;&#x662F;&#x9519;&#x8BEF;&#x7684;&#x3002;
T [ ] b=new T[10];&#x5982;&#x679C;&#x5F00;&#x53D1;&#x8005;&#x60F3;&#x9650;&#x5236;&#x6CDB;&#x578B;&#x7684;&#x5B9E;&#x4F8B;&#x5316;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4E0B;&#x9762;&#x7684;&#x65B9;&#x6CD5;&#x3002;
&#x6CDB;&#x578B;&#x7C7B;&#x540D;&lt;;T  extends  &#x8D85;&#x7C7B;&gt;;&#x8303;&#x4F8B;10-5 &#x6CDB;&#x578B;&#x7C7B;&#x7684;&#x5B9E;&#x4F8B;&#x5316;&#x9650;&#x5236;</t></t></p>
<pre class="language-"><code class="lang-java">&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">Base</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">T</span> <span class="token keyword">extends</span> supA<span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;<span class="token class-name">T</span> m<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token class-name">Base</span><span class="token punctuation">(</span><span class="token class-name">T</span> t<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;  m <span class="token operator">=</span> t<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token class-name">T</span> <span class="token function">getM</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;  <span class="token keyword">return</span> m<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">print</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">&quot;base print &#xFF1A;&quot;</span> <span class="token operator">+</span> m<span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token class-name">B</span> bb<span class="token operator">=</span><span class="token keyword">new</span> <span class="token class-name">B</span><span class="token punctuation">(</span><span class="token string">&quot;test B&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token class-name">Base</span><span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">B</span><span class="token operator">&gt;</span><span class="token punctuation">;</span> base<span class="token operator">=</span><span class="token keyword">new</span> <span class="token class-name">Base</span><span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">B</span><span class="token operator">&gt;</span><span class="token punctuation">;</span><span class="token punctuation">(</span>bb<span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment">//&#x5141;&#x8BB8;</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token class-name">Base</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span> base<span class="token operator">=</span><span class="token keyword">new</span> <span class="token class-name">Base</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">(</span><span class="token string">&quot;base class is general&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>  <span class="token comment">//&#x4E0D;&#x5141;&#x8BB8;</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>base<span class="token punctuation">.</span><span class="token function">getM</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">class</span> supA<span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">toString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token keyword">return</span> <span class="token string">&quot;supA&quot;</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">class</span> <span class="token class-name">B</span> <span class="token keyword">extends</span> supA<span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;<span class="token class-name">String</span> b<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token class-name">B</span><span class="token punctuation">(</span><span class="token class-name">String</span> b<span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token keyword">this</span><span class="token punctuation">.</span>b<span class="token operator">=</span>b<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">toString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token keyword">return</span> <span class="token string">&quot;subB&quot;</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p>&#x901A;&#x8FC7;T extends supA&#x5C06;&#x6CDB;&#x578B;&#x5B9E;&#x4F8B;&#x5316;&#x7684;&#x5BF9;&#x8C61;&#x9650;&#x5236;&#x5230;&#x5FC5;&#x987B;&#x662F;supA&#x7684;&#x5B50;&#x7C7B;&#xFF0C;&#x6240;&#x4EE5;&#x7B2C;14&#x884C;&#x662F;&#x5141;&#x8BB8;&#x7684;&#xFF0C;&#x800C;&#x7B2C;15&#x884C;&#x662F;&#x4E0D;&#x5141;&#x8BB8;&#x7684;&#x3002;
supA&#x53EF;&#x4EE5;&#x662F;&#x63A5;&#x53E3;&#xFF0C;&#x4F46;&#x662F;extends&#x4E0D;&#x80FD;&#x6362;&#x6210;implements&#xFF0C;&#x5FC5;&#x987B;&#x4F7F;&#x7528;extends&#x3002;
10.5.2 &#x901A;&#x914D;&#x7B26;&#x7684;&#x4F7F;&#x7528;&#x5F15;&#x5165;&#x901A;&#x914D;&#x7B26;&#x53EF;&#x4EE5;&#x5728;&#x6CDB;&#x578B;&#x5B9E;&#x4F8B;&#x5316;&#x65F6;&#x66F4;&#x52A0;&#x7075;&#x6D3B;&#x5730;&#x63A7;&#x5236;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x7528;&#x5728;&#x65B9;&#x6CD5;&#x4E2D;&#x63A7;&#x5236;&#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#x3002;
&#x8BED;&#x6CD5;&#x5982;&#x4E0B;&#x6240;&#x793A;&#x3002;
&#x6CDB;&#x578B;&#x7C7B;&#x540D;&lt;;?  extends  T&gt;;&#x6216;&#x6CDB;&#x578B;&#x7C7B;&#x540D;&lt;;?  super  T&gt;;extends&#x89C4;&#x5B9A;&#x4E86;&#x201C;&#xFF1F;&#x201D;&#x7684;&#x4E0A;&#x9650;&#xFF0C;super&#x89C4;&#x5B9A;&#x4E86;&#x201C;&#xFF1F;&#x201D;&#x7684;&#x4E0B;&#x9650;&#xFF0C;&#x8FD8;&#x6709;&#x4E00;&#x79CD;&#x505A;&#x6CD5;&#x662F;&#x7701;&#x7565;&#x4E86;extends&#xFF0C;&#x770B;&#x8D77;&#x6765;&#x662F;&#x4E0B;&#x9762;&#x7684;&#x5F62;&#x5F0F;&#x3002;
&#x6CDB;&#x578B;&#x7C7B;&#x540D;&lt;;? &gt;;&#x8FD9;&#x8868;&#x793A;&#x6CDB;&#x578B;&#x5B9E;&#x4F8B;&#x5316;&#x5BF9;&#x8C61;&#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x4F55;&#x5141;&#x8BB8;&#x7684;&#x7C7B;&#x578B;&#x3002;
&#x8303;&#x4F8B;10-6 &#x901A;&#x914D;&#x7B26;&#x5728;&#x6CDB;&#x578B;&#x7C7B;&#x521B;&#x5EFA;&#x6CDB;&#x578B;&#x5BF9;&#x8C61;&#x4E2D;&#x4F7F;&#x7528;</p>
<pre class="language-"><code class="lang-java">&#x3000;<span class="token keyword">class</span> gent <span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">T</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">{</span>&#x3000;
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> testa <span class="token punctuation">{</span>&#x3000;
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;  gent <span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token operator">?</span> <span class="token keyword">extends</span> <span class="token class-name">String</span><span class="token operator">&gt;</span><span class="token punctuation">;</span> o<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000;  o<span class="token operator">=</span><span class="token keyword">new</span> gent<span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment">//&#x6B63;&#x786E;</span>
&#x3000;&#x3000;&#x3000;&#x3000;  o<span class="token operator">=</span><span class="token keyword">new</span> gent<span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">Number</span><span class="token operator">&gt;</span><span class="token punctuation">;</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment">//&#x9519;&#x8BEF;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>&#x3000;
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p>&#x7B2C;4&#x884C;&#x7684;o&#x5BF9;&#x8C61;&#x58F0;&#x660E;&#x4E2D;&#x201C;? extends String&#x201D;&#x51B3;&#x5B9A;&#x4E86;&#x6CDB;&#x578B;&#x7684;&#x5B9E;&#x4F8B;&#x5316;&#x5BF9;&#x8C61;&#x53EA;&#x80FD;&#x662F;String&#x7C7B;&#x6216;&#x5B83;&#x7684;&#x5B50;&#x7C7B;&#xFF0C;&#x6240;&#x4EE5;&#x7B2C;
&#x884C;&#x6B63;&#x786E;&#xFF0C;&#x800C;&#x7B2C;07&#x884C;&#x662F;&#x9519;&#x8BEF;&#x7684;&#x3002;
&#x8303;&#x4F8B;10-7 &#x901A;&#x914D;&#x7B26;&#x5728;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x4E2D;&#x7684;&#x4F7F;&#x7528;</p>
<pre class="language-"><code class="lang-java">&#x3000;<span class="token keyword">class</span> supC<span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">toString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token keyword">return</span> <span class="token string">&quot;supA&quot;</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">class</span> <span class="token class-name">Bc</span> <span class="token keyword">extends</span> supC<span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;<span class="token class-name">String</span> b<span class="token punctuation">;</span>
&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token class-name">Bc</span><span class="token punctuation">(</span><span class="token class-name">String</span> b<span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token keyword">this</span><span class="token punctuation">.</span>b<span class="token operator">=</span>b<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">toString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token keyword">return</span> <span class="token string">&quot;subB&quot;</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">test</span><span class="token punctuation">(</span>gent<span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token operator">?</span> <span class="token keyword">extends</span> supC<span class="token operator">&gt;</span><span class="token punctuation">;</span> o<span class="token punctuation">)</span><span class="token punctuation">{</span>&#x3000;&#x3000;
&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token class-name">Bc</span> bc<span class="token operator">=</span><span class="token keyword">new</span> <span class="token class-name">Bc</span><span class="token punctuation">(</span><span class="token string">&quot;test&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; gent<span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">Bc</span><span class="token operator">&gt;</span><span class="token punctuation">;</span> oGent<span class="token operator">=</span><span class="token keyword">new</span> gent<span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">Bc</span><span class="token operator">&gt;</span><span class="token punctuation">;</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; bc<span class="token punctuation">.</span><span class="token function">test</span><span class="token punctuation">(</span>oGent<span class="token punctuation">)</span><span class="token punctuation">;</span>&#x3000;&#x3000;
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p>&#x7B2C;14&#x884C;&#x5B9A;&#x4E49;&#x4E86;&#x65B9;&#x6CD5;test&#x7684;&#x53C2;&#x6570;o&#xFF0C;&#x6307;&#x660E;&#x6CDB;&#x578B;&#x53C2;&#x6570;&#x5FC5;&#x987B;&#x662F;supC&#x7C7B;&#x6216;&#x5176;&#x5B50;&#x7C7B;&#xFF0C;&#x7B2C;19&#x884C;&#x662F;&#x8C03;&#x7528;&#xFF0C;oGent&#x662F;supC&#x7684;&#x5B50;&#x7C7B;&#x5BF9;&#x8C61;&#x3002;
10.6 &#x6CDB;&#x578B;&#x7684;&#x7EE7;&#x627F;&#x548C;&#x5B9E;&#x73B0;&#x6CDB;&#x578B;&#x7C7B;&#x548C;&#x6CDB;&#x578B;&#x63A5;&#x53E3;&#x88AB;&#x5B9A;&#x4E49;&#x540E;&#xFF0C;&#x662F;&#x53EF;&#x4EE5;&#x88AB;&#x7EE7;&#x627F;&#x548C;&#x5B9E;&#x73B0;&#x7684;&#x3002;
&#x4E0B;&#x9762;&#x4E3E;&#x4F8B;&#x8BF4;&#x660E;&#x6CDB;&#x578B;&#x7C7B;&#x7684;&#x7EE7;&#x627F;&#x548C;&#x6CDB;&#x578B;&#x63A5;&#x53E3;&#x7684;&#x5B9E;&#x73B0;&#x8FC7;&#x7A0B;&#x3002;
&#x8303;&#x4F8B;10-8 &#x6CDB;&#x578B;&#x7C7B;&#x7684;&#x7EE7;&#x627F;</p>
<pre class="language-"><code class="lang-java">&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">A</span><span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">E</span><span class="token operator">&gt;</span><span class="token punctuation">;</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;<span class="token class-name">E</span> t<span class="token punctuation">;</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">B</span><span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">T</span><span class="token punctuation">,</span>T1<span class="token operator">&gt;</span><span class="token punctuation">;</span> <span class="token keyword">extends</span> <span class="token class-name">A</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">T</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p>&#x5B50;&#x7C7B;B&#x5728;&#x5B9A;&#x4E49;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5982;&#x679C;&#x7701;&#x7565;&#x4E86;A&#x540E;&#x7684;<t>;&#xFF0C;&#x90A3;&#x4E48;B&#x7684;T&#x81EA;&#x52A8;&#x53D8;&#x6210;Object&#xFF0C;&#x5EFA;&#x8BAE;&#x5B9A;&#x4E49;&#x65F6;&#x52A0;&#x4E0A;<t>;&#x4EE5;&#x4FDD;&#x7559;&#x7236;&#x7C7B;&#x7684;&#x7C7B;&#x578B;&#x53C2;&#x6570;&#x3002;
B&#x7C7B;&#x8FD8;&#x53EF;&#x4EE5;&#x589E;&#x52A0;&#x65B0;&#x7684;&#x6CDB;&#x578B;T1&#x3002;
&#x8303;&#x4F8B;10-9 &#x6CDB;&#x578B;&#x63A5;&#x53E3;&#x7684;&#x5B9E;&#x73B0;</t></t></p>
<pre class="language-"><code class="lang-java">&#x3000;<span class="token keyword">interface</span> IT<span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">T</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token class-name">T</span> <span class="token function">dis</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> testIT<span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">E</span><span class="token operator">&gt;</span><span class="token punctuation">;</span> <span class="token keyword">implements</span> IT<span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">E</span><span class="token operator">&gt;</span><span class="token punctuation">;</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;<span class="token class-name">E</span> e<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token function">testIT</span><span class="token punctuation">(</span><span class="token class-name">E</span> e<span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token keyword">this</span><span class="token punctuation">.</span>e<span class="token operator">=</span>e<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token class-name">E</span> <span class="token function">dis</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>&#x3000;&#x3000;
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token keyword">return</span> e<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; testIT<span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span> tt<span class="token operator">=</span><span class="token keyword">new</span> testIT<span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">(</span><span class="token string">&quot;test&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000; <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>tt<span class="token punctuation">.</span><span class="token function">dis</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p>&#x5B9E;&#x73B0;&#x7C7B;testIT&#x4E0D;&#x80FD;&#x7701;&#x7565;&lt;;E&gt;;&#xFF0C;&#x5FC5;&#x987B;&#x548C;&#x666E;&#x901A;&#x5B9E;&#x73B0;&#x7C7B;&#x4E00;&#x6837;&#xFF0C;&#x5B9E;&#x73B0;IT&#x63A5;&#x53E3;&#x4E2D;&#x7684;&#x6240;&#x6709;&#x65B9;&#x6CD5;&#x3002;
10.7 &#x9AD8;&#x624B;&#x70B9;&#x62E8;1.&#x6CDB;&#x578B;&#x7684;&#x4F7F;&#x7528;&#x5927;&#x5927;&#x589E;&#x52A0;&#x4E86;&#x7A0B;&#x5E8F;&#x8BBE;&#x8BA1;&#x7684;&#x7075;&#x6D3B;&#x6027;&#xFF0C;&#x5FC5;&#x8981;&#x65F6;&#xFF0C;&#x65B9;&#x6CD5;&#x7684;&#x540D;&#x5B57;&#x53EF;&#x4EE5;&#x7528;&#x6CDB;&#x578B;&#x66FF;&#x4EE3;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#x3002;</p>
<pre class="language-"><code class="lang-java">&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">SupGent</span> <span class="token punctuation">{</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">A</span><span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">E</span><span class="token operator">&gt;</span><span class="token punctuation">;</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000; <span class="token class-name">E</span> t<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token class-name">A</span><span class="token punctuation">(</span><span class="token class-name">E</span> t<span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;  <span class="token keyword">this</span><span class="token punctuation">.</span>t<span class="token operator">=</span>t<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token class-name">E</span> <span class="token class-name">E</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;<span class="token keyword">return</span> t<span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">B</span><span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">E</span><span class="token operator">&gt;</span><span class="token punctuation">;</span> <span class="token keyword">extends</span> <span class="token class-name">A</span><span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">E</span><span class="token operator">&gt;</span><span class="token punctuation">;</span><span class="token punctuation">{</span>
&#x3000;&#x3000;&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token class-name">B</span><span class="token punctuation">(</span><span class="token class-name">E</span> t<span class="token punctuation">)</span><span class="token punctuation">{</span>
&#x3000;&#x3000;<span class="token keyword">super</span><span class="token punctuation">(</span>t<span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000; <span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000;&#x3000;<span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span><span class="token punctuation">{</span>&#x3000;
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token class-name">SupGent</span><span class="token punctuation">.</span><span class="token class-name">B</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span> b<span class="token operator">=</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">SupGent</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token keyword">new</span> <span class="token class-name">B</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">(</span><span class="token string">&quot;test&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
&#x3000;&#x3000;&#x3000;&#x3000;&#x3000;<span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>b<span class="token punctuation">.</span><span class="token class-name">E</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> &#x3000;
&#x3000;&#x3000;&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p>&#x7B2C;07&#x884C;&#x91C7;&#x7528;&#x4E86;&#x6CDB;&#x578B;E&#xFF0C;&#x78B0;&#x5DE7;&#x65B9;&#x6CD5;&#x7684;&#x540D;&#x5B57;&#x4E5F;&#x662F;E&#xFF0C;&#x53EA;&#x4E0D;&#x8FC7;&#x4E0D;&#x8981;&#x5F04;&#x6DF7;&#xFF0C;&#x4E0A;&#x4F8B;&#x8F93;&#x51FA;&#x7ED3;&#x679C;&#x4E3A;test&#x3002;
2.&#x5728;&#x8FDB;&#x884C;&#x6570;&#x636E;&#x5E93;DAO&#x5C01;&#x88C5;&#x64CD;&#x4F5C;&#x65F6;&#xFF0C;&#x91C7;&#x7528;&#x6CDB;&#x578B;&#x53EF;&#x4EE5;&#x7B80;&#x5316;&#x5F00;&#x53D1;&#x3002;</p>
<pre class="language-"><code class="lang-java">&#x3000;<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">BaseDAO</span> <span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">T</span><span class="token punctuation">&gt;</span></span><span class="token punctuation">;</span><span class="token punctuation">{</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token class-name">Save</span><span class="token punctuation">(</span><span class="token class-name">T</span> t<span class="token punctuation">)</span><span class="token punctuation">{</span>&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token class-name">Del</span><span class="token punctuation">(</span><span class="token class-name">T</span> t<span class="token punctuation">)</span><span class="token punctuation">{</span>&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token class-name">Update</span><span class="token punctuation">(</span><span class="token class-name">T</span> t<span class="token punctuation">)</span><span class="token punctuation">{</span>&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token class-name">Search</span><span class="token punctuation">(</span><span class="token class-name">T</span> t<span class="token punctuation">)</span><span class="token punctuation">{</span>&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">class</span> <span class="token class-name">TeacherDao</span> <span class="token keyword">extends</span> <span class="token class-name">BaseDAO</span><span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">Teacher</span><span class="token operator">&gt;</span><span class="token punctuation">;</span><span class="token punctuation">{</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token class-name">Save</span><span class="token punctuation">(</span><span class="token class-name">Teacher</span> t<span class="token punctuation">)</span><span class="token punctuation">{</span>&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">newOperator</span><span class="token punctuation">(</span><span class="token class-name">Teacher</span> t<span class="token punctuation">)</span><span class="token punctuation">{</span>&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token keyword">class</span> <span class="token class-name">StudentDao</span> <span class="token keyword">extends</span> <span class="token class-name">BaseDAO</span><span class="token operator">&lt;</span><span class="token punctuation">;</span><span class="token class-name">Student</span><span class="token operator">&gt;</span><span class="token punctuation">;</span><span class="token punctuation">{</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token class-name">Save</span><span class="token punctuation">(</span><span class="token class-name">Student</span> t<span class="token punctuation">)</span><span class="token punctuation">{</span>&#x3000;<span class="token punctuation">}</span>
&#x3000;&#x3000; <span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">newOperator2</span><span class="token punctuation">(</span><span class="token class-name">Student</span> t<span class="token punctuation">)</span><span class="token punctuation">{</span>&#x3000;<span class="token punctuation">}</span>
&#x3000;<span class="token punctuation">}</span>
</code></pre>
<p>&#x3000;class Teacher{}
&#x3000;class Student{}BaseDAO&#x5B9A;&#x4E49;&#x4E86;&#x57FA;&#x672C;&#x7684;&#x6570;&#x636E;&#x5E93;&#x589E;&#x5220;&#x6539;&#x67E5;&#xFF0C;&#x4E4B;&#x540E;&#x53EF;&#x4EE5;&#x7EE7;&#x627F;&#x8BE5;&#x6CDB;&#x578B;&#x7C7B;&#xFF0C;&#x5B9E;&#x73B0;&#x5404;&#x81EA;&#x7684;&#x589E;&#x5220;&#x6539;&#x67E5;&#xFF0C;&#x6216;&#x8005;&#x4F7F;&#x7528;&#x8D85;&#x7C7B;&#x7684;&#x589E;&#x5220;&#x6539;&#x67E5;&#xFF0C;&#x540C;&#x65F6;&#x6BCF;&#x4E2A;&#x7EE7;&#x627F;&#x7C7B;&#x8FD8;&#x53EF;&#x4EE5;&#x589E;&#x52A0;&#x81EA;&#x5DF1;&#x7684;&#x64CD;&#x4F5C;&#x3002;
10.8 &#x5B9E;&#x6218;&#x7EC3;&#x4E60;&#x53C2;&#x7167;&#x9AD8;&#x624B;&#x70B9;&#x62E8;&#x4E2D;&#x7684;&#x7B2C;2&#x9898;&#xFF0C;&#x5B8C;&#x5584;&#x4F8B;&#x5B50;&#x4E2D;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x5B9E;&#x73B0;&#x6559;&#x5E08;&#x6216;&#x5B66;&#x751F;&#x7684;&#x589E;&#x5220;&#x6539;&#x67E5;&#xFF0C;&#x5C1D;&#x8BD5;&#x7ED9;TeacherDao&#x3001;StudentDao&#x589E;&#x52A0;&#x65B0;&#x7684;&#x6570;&#x636E;&#x5E93;&#x64CD;&#x4F5C;&#x3002;</p>

</div>

                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="java13.html#7" class="navigation navigation-prev " aria-label="Previous page: 9.7 实战练习">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="java15.html" class="navigation navigation-next " aria-label="Next page: 更强大和方便的功能--注解">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"更灵活的设计--泛型","level":"1.2.11","depth":2,"next":{"title":"更强大和方便的功能--注解","level":"1.2.12","depth":2,"path":"java15.md","ref":"java15.md","articles":[]},"previous":{"title":"9.7 实战练习","level":"1.2.10.7","depth":3,"anchor":"#7","path":"java13.md","ref":"java13.md#7","articles":[]},"dir":"ltr"},"config":{"plugins":["simple-mind-map","new-flowchart","mermaid-gb3@2.1.0","hide-element","-lunr","-search","search-plus@^0.0.11","back-to-top-button","openwrite","code","prism","-highlight","-livereload","expandable-chapters","timeline","todo","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"timeline":{},"prism":{"css":["prismjs/themes/prism-tomorrow.css"]},"new-flowchart":{},"todo":{},"code":{"copyButtons":true},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"openwrite":{"blogId":"18972-1576749538667-677","name":"谦谦君子","qrcode":"https://image.lichongbing.com/qrcode_for_gh_29bad7d68f3a_258.jpg","keyword":"更多"},"back-to-top-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"simple-mind-map":{"autoFit":true,"linkShape":"diagonal","preset":"colorful","style":{"height":"750px","wight":"1000px"},"type":"markdown"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"snowdreams1006","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Java笔记Blog","links":{"sidebar":{"blog":"https://blog.lichongbing.com/"}},"gitbook":"3.2.3","description":"gitbook-plugin-simple-mind-map examples"},"file":{"path":"java14.md","mtime":"2020-10-29T10:18:26.631Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-11-06T13:32:17.508Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    
    

    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-simple-mind-map/bundle.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-new-flowchart/raphael-min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-new-flowchart/flowchart-1.6.2.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-new-flowchart/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

<script src="https://my.openwrite.cn/js/readmore.js" type="text/javascript"></script>
<script>
var isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
if (!isMobile) {
    var btw = new BTWPlugin();
    btw.init({
        "id": "vip-container",
        "blogId": "18972-1576749538667-677",
        "name": "谦谦君子",
        "qrcode": "https://image.lichongbing.com/qrcode_for_gh_29bad7d68f3a_258.jpg",
        "keyword": "更多"
    });
}
</script>

    <script src="gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>


    </body>
</html>

